﻿Public Module BussinesLogicGenericHelper

    Public Function getBussinesLogicGeneric(ByVal className As String) As Object
        Dim inst = ReflectionHelper.GetEntityClassInstance(className)
        Dim classType As Type = GetType(BussinesLogicGeneric(Of ))

        Dim typeParams As Type = inst.GetType()
        Dim constructedType As Type = classType.MakeGenericType(typeParams)

        Dim obj = Activator.CreateInstance(constructedType)

        If Not GetType(EntityBase).IsAssignableFrom(inst.GetType()) Then
            Throw New ApplicationException(" la clase " & className & " no implementa EntityBase")
        End If
        Return obj
    End Function


End Module
